/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2025-10-08
 * Time: 17:00
 */
class Singleton{
    private static Singleton instance = new Singleton();

    //后续通过get方法获取这里的实例
    public static Singleton getInstance(){
        return instance;
    }

    //点睛之笔，在外面进行new操作，都会编译失败
    private Singleton(){

    }
}


public class demo1 {
    public static void main(String[] args) {
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();

        System.out.println(s1 == s2);
    }
}
